﻿@model IEnumerable<FTBS.Models.Entities.Film>

@{
    ViewBag.Title = "Quản lí phim";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";

}

<h2>DANH SÁCH PHIM</h2>

<p>
    @Html.ActionLink("Thêm Phim", "Create")
</p>
<table class="table striped bordered hovered" style="margin: 0px 0px 0px 40px">
    <tr>
        <th>Tên phim 
        </th>
        <th>Độ dài
        </th>
        <th>Quốc gia
        </th>
        <th>Lứa tuổi    
        </th>
        <th>Định dạng
        </th>
        <th>Thể loại
        </th>
        <th></th>
        <th></th>
    </tr>
    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Length)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Nation)
            </td>

            <td>
                @Html.DisplayFor(modelItem => item.AgeLimit)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Format.FormatName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Category.CategoryName)
            </td>
            <td>
                @Html.ActionLink("Sửa", "Edit", new { id = item.FilmId }) |
            @Html.ActionLink("Chi tiết", "Details", new { id = item.FilmId })

            </td>
            <td>@using (Html.BeginForm("Delete", "Film", new { id = item.FilmId }, FormMethod.Post,
             new { onsubmit = "return confirm('Bạn có chắc chắn muốn xóa phim này không?');" }))
                {
                @Html.HttpMethodOverride(HttpVerbs.Delete)
                <button type="submit" style="background: none; border: none; display: inline; font: inherit; margin: 0; padding: 0; outline: none; outline-offset: 0; /* Additional styles to look like a link */
    color: #2e92cf; cursor: pointer; text-decoration: underline;">
                    Xóa</button>
                }</td>
        </tr>
    }
</table>

